<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to select all existing products
	*/
	class CommandSelectProducts extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct() {}
		
		/*
		 * Method to execute to select all existing products
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ipad = $daoFactory -> getMySqlProductAccessDao();			
			$sentence = $ipad -> selectProducts();
			
			$products = ''; $i = 0;
			while ($row = mysql_fetch_array($sentence)) {
				$products['pk_code'][$i] = $row['pk_code'];
				$products['name'][$i] = $row['name'];
				$products['specifications'][$i++] = $row['specifications'];
			}			
			
			$this -> result = $products;
		}
	}
?>